package com.triz.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.triz.common.annotation.Log;
import com.triz.common.core.controller.BaseController;
import com.triz.common.core.domain.AjaxResult;
import com.triz.common.enums.BusinessType;
import com.triz.business.domain.IndustryDevelopment;
import com.triz.business.service.IIndustryDevelopmentService;
import com.triz.common.utils.poi.ExcelUtil;
import com.triz.common.core.page.TableDataInfo;

/**
 * 行业发展信息Controller
 * 
 * @author hlk
 * @date 2025-11-11
 */
@RestController
@RequestMapping("/business/development")
public class IndustryDevelopmentController extends BaseController
{
    @Autowired
    private IIndustryDevelopmentService industryDevelopmentService;

    /**
     * 查询行业发展信息列表
     */
//    @PreAuthorize("@ss.hasPermi('business:development:list')")
    @GetMapping("/list")
    public TableDataInfo list(IndustryDevelopment industryDevelopment)
    {
        startPage();
        List<IndustryDevelopment> list = industryDevelopmentService.selectIndustryDevelopmentList(industryDevelopment);
        return getDataTable(list);
    }

    /**
     * 导出行业发展信息列表
     */
//    @PreAuthorize("@ss.hasPermi('business:development:export')")
    @Log(title = "行业发展信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IndustryDevelopment industryDevelopment)
    {
        List<IndustryDevelopment> list = industryDevelopmentService.selectIndustryDevelopmentList(industryDevelopment);
        ExcelUtil<IndustryDevelopment> util = new ExcelUtil<IndustryDevelopment>(IndustryDevelopment.class);
        util.exportExcel(response, list, "行业发展信息数据");
    }

    /**
     * 获取行业发展信息详细信息
     */
//    @PreAuthorize("@ss.hasPermi('business:development:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(industryDevelopmentService.selectIndustryDevelopmentById(id));
    }

    /**
     * 新增行业发展信息
     */
//    @PreAuthorize("@ss.hasPermi('business:development:add')")
    @Log(title = "行业发展信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody IndustryDevelopment industryDevelopment)
    {
        industryDevelopment.setCreateBy(getUsername());
        return toAjax(industryDevelopmentService.insertIndustryDevelopment(industryDevelopment));
    }

    /**
     * 修改行业发展信息
     */
//    @PreAuthorize("@ss.hasPermi('business:development:edit')")
    @Log(title = "行业发展信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody IndustryDevelopment industryDevelopment)
    {
        industryDevelopment.setUpdateBy(getUsername());
        return toAjax(industryDevelopmentService.updateIndustryDevelopment(industryDevelopment));
    }

    /**
     * 删除行业发展信息
     */
//    @PreAuthorize("@ss.hasPermi('business:development:remove')")
    @Log(title = "行业发展信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(industryDevelopmentService.deleteIndustryDevelopmentByIds(ids));
    }




}
